<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		
		<style type="text/css">
			.red{
				color: red;
			}
		</style>
	</head>
	<body>
		<div id="app">
			<h2>{{demo}}</h2>
			<ul>
				<li v-for="(item,index) in movie" 
					@click="red(index)" 
					:class="{red:currentIndex === index }">
						{{index}}-{{item}}
				</li>
			</ul>
		</div>
		
		
		
		<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
		<script type="text/javascript">
			var app = new Vue({
				el:'#app',
				data:{
					demo:'123',
					movie:['demo1','demo2','demo3'],
					currentIndex:0,
				},
				methods:{			
					//对象增强写法
					red(index){
						this.currentIndex = index;
						
					}
				}
			})
		</script>
	</body>
</html>
